home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / ds3100.md / sii.h < prev    next >
C/C++ Source or Header  |  1989-07-08  |  8KB  |  214 lines

  1. /*
  2.  * sii.h --
  3.  *
  4.  *     SII registers.
  5.  *
  6.  * Copyright (C) 1989 by Digital Equipment Corporation, Maynard MA
  7.  *
  8.  *            All Rights Reserved
  9.  *
  10.  * Permission to use, copy, modify, and distribute this software and its 
  11.  * documentation for any purpose and without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and that
  13.  * both that copyright notice and this permission notice appear in 
  14.  * supporting documentation, and that the name of Digital not be
  15.  * used in advertising or publicity pertaining to distribution of the
  16.  * software without specific, written prior permission.  
  17.  *
  18.  * Digitial disclaims all warranties with regard to this software, including
  19.  * all implied warranties of merchantability and fitness.  In no event shall
  20.  * Digital be liable for any special, indirect or consequential damages or
  21.  * any damages whatsoever resulting from loss of use, data or profits,
  22.  * whether in an action of contract, negligence or other tortious action,
  23.  * arising out of or in connection with the use or performance of this
  24.  * software.
  25.  *
  26.  * $Header: sii.h,v 1.2 89/06/09 17:17:15 mnelson Exp $ SPRITE (DECWR
  27. L)
  28.  */
  29.  
  30. #ifndef _SII
  31.  
  32. #include "scsiDevice.h"
  33. #include "machAddrs.h"
  34.  
  35. /*
  36.  * SII registers
  37.  */
  38. typedef struct {
  39.     unsigned short sdb;    /* SCSI Data Bus and Parity        */
  40.     unsigned short pad0;
  41.     unsigned short sc1;    /* SCSI Control Signals One        */
  42.     unsigned short pad1;
  43.     unsigned short sc2;    /* SCSI Control Signals Two        */
  44.     unsigned short pad2;
  45.     unsigned short csr;    /* Control/Status register        */
  46.     unsigned short pad3;
  47.     unsigned short id;        /* Bus ID register        */
  48.     unsigned short pad4;
  49.     unsigned short slcsr;    /* Select Control and Status Register    */
  50.     unsigned short pad5;
  51.     unsigned short destat;    /* Selection Detector Status Register    */
  52.     unsigned short pad6;
  53.     unsigned short dstmo;    /* DSSI Timeout Register        */
  54.     unsigned short pad7;
  55.     unsigned short data;    /* Data Register            */
  56.     unsigned short pad8;
  57.     unsigned short dmctrl;    /* DMA Control Register            */
  58.     unsigned short pad9;
  59.     unsigned short dmlotc;    /* DMA Length of Transfer Counter    */
  60.     unsigned short pad10;
  61.     unsigned short dmaddrl;    /* DMA Address Register Low        */
  62.     unsigned short pad11;
  63.     unsigned short dmaddrh;    /* DMA Address Register High        */
  64.     unsigned short pad12;
  65.     unsigned short dmabyte;    /* DMA Initial Byte Register        */
  66.     unsigned short pad13;
  67.     unsigned short stlp;    /* DSSI Short Target List Pointer    */
  68.     unsigned short pad14;
  69.     unsigned short ltlp;    /* DSSI Long Target List Pointer    */
  70.     unsigned short pad15;
  71.     unsigned short ilp;    /* DSSI Initiator List Pointer        */
  72.     unsigned short pad16;
  73.     unsigned short dsctrl;    /* DSSI Control Register        */
  74.     unsigned short pad17;
  75.     unsigned short cstat;    /* Connection Status Register        */
  76.     unsigned short pad18;
  77.     unsigned short dstat;    /* Data Transfer Status Register    */
  78.     unsigned short pad19;
  79.     unsigned short comm;    /* Command Register            */
  80.     unsigned short pad20;
  81.     unsigned short dictrl;    /* Diagnostic Control Register        */
  82.     unsigned short pad21;
  83.     unsigned short clock;    /* Diagnostic Clock Register        */
  84.     unsigned short pad22;
  85.     unsigned short bhdiag;    /* Bus Handler Diagnostic Register    */
  86.     unsigned short pad23;
  87.     unsigned short sidiag;    /* SCSI IO Diagnostic Register        */
  88.     unsigned short pad24;
  89.     unsigned short dmdiag;    /* Data Mover Diagnostic Register    */
  90.     unsigned short pad25;
  91.     unsigned short mcdiag;    /* Main Control Diagnostic Register    */
  92.     unsigned short pad26;
  93. } SIIRegs;
  94.  
  95. #define SII_REG_BASE    (volatile SIIRegs *)MACH_SCSI_INTERFACE_ADDR
  96. #define SII_BUF_BASE    (volatile char *)MACH_SCSI_BUFFER_ADDR
  97. #define SII_REG_ADDR    (SII_REG_BASE)
  98. #define SII_BUF_ADDR    (SII_BUF_BASE)
  99.  
  100. /*
  101.  * SC1 - SCSI Control Signals One
  102.  */
  103. #define SII_SC1_MSK    0x1ff        /* All possible signals on the bus    */
  104. #define SII_SC1_SEL    0x80        /* SCSI SEL signal active on bus      */
  105. #define SII_SC1_ATN    0x08        /* SCSI ATN signal active on bus      */
  106.  
  107. /*
  108.  * SC2 - SCSI Control Signals Two
  109.  */
  110. #define SII_SC2_IGS    0x8        /* SCSI drivers for initiator mode    */
  111.  
  112. /*
  113.  * CSR - Control/Status Register
  114.  */
  115. #define SII_HPM    0x10            /* SII in on an arbitrated SCSI bus   */
  116. #define    SII_RSE    0x08            /* 1 = respond to reselections          */
  117. #define SII_SLE    0x04            /* 1 = respond to selections          */
  118. #define SII_PCE    0x02            /* 1 = report parity errors          */
  119. #define SII_IE    0x01            /* 1 = enable interrupts          */
  120.  
  121. /*
  122.  * ID - Bus ID Register
  123.  */
  124. #define SII_ID_IO    0x8000        /* I/O                       */
  125.  
  126. /*
  127.  * DESTAT - Selection Detector Status Register
  128.  */
  129. #define SII_IDMSK    0x7        /* ID of target reselected the SII    */
  130.  
  131. /*
  132.  * DMCTRL - DMA Control Register
  133.  */
  134. #define SII_ASYNC    0x00        /* REQ/ACK Offset for async mode      */
  135. #define SII_SYNC    0x03        /* REQ/ACK Offset for sync mode          */
  136.  
  137. /*
  138.  * DMLOTC - DMA Length Of Transfer Counter
  139.  */
  140. #define SII_TCMSK    0x1fff        /* transfer count mask              */
  141.  
  142. /*
  143.  * CSTAT - Connection Status Register
  144.  */
  145. #define    SII_CI        0x8000    /* composite interrupt bit for CSTAT          */
  146. #define SII_DI        0x4000    /* composite interrupt bit for DSTAT          */
  147. #define SII_RST_ONBUS    0x2000    /* 1 if reset is asserted on SCSI bus          */
  148. #define    SII_BER        0x1000    /* Bus error                      */
  149. #define    SII_OBC        0x0800    /* Out_en Bit Cleared (DSSI mode)          */
  150. #define SII_TZ        0x0400    /* Target pointer Zero (STLP or LTLP is zero) */
  151. #define    SII_BUF        0x0200    /* Buffer service - outbound pkt to non-DSSI  */
  152. #define SII_LDN        0x0100    /* List element Done                  */
  153. #define SII_SCH        0x0080    /* State Change                      */
  154. #define SII_CON        0x0040    /* SII is Connected to another device          */
  155. #define SII_DST_ONBUS    0x0020    /* SII was Destination of current transfer    */
  156. #define SII_TGT_ONBUS    0x0010    /* SII is operating as a Target              */
  157. #define SII_SWA        0x0008    /* Selected With Attention              */
  158. #define SII_SIP        0x0004    /* Selection In Progress              */
  159. #define SII_LST        0x0002    /* Lost arbitration                  */
  160.  
  161. /*
  162.  * DSTAT - Data Transfer Status Register
  163.  */
  164. #define SII_DNE        0x2000    /* DMA transfer Done                  */
  165. #define SII_TCZ        0x1000    /* Transfer Count register is Zero          */
  166. #define SII_TBE        0x0800    /* Transmit Buffer Empty              */
  167. #define SII_IBF        0x0400    /* Input Buffer Full                  */
  168. #define SII_IPE        0x0200    /* Incoming Parity Error              */
  169. #define SII_OBB        0x0100    /* Odd Byte Boundry                  */
  170. #define SII_MIS        0x0010    /* Phase Mismatch                  */
  171. #define SII_ATN        0x0008    /* ATN set by initiator if in Target mode     */
  172. #define SII_MSG        0x0004    /* current bus state of MSG              */
  173. #define SII_CD        0x0002    /* current bus state of C/D              */
  174. #define SII_IO        0x0001    /* current bus state of I/O              */
  175. #define SII_PHA_MSK    0x0007    /* Phase Mask                      */
  176.  
  177. /*
  178.  * COMM - Command Register
  179.  */
  180. #define    SII_DMA        0x8000    /* DMA mode                      */
  181. #define SII_RST        0x4000    /* Assert reset on SCSI bus for 25 usecs      */
  182. #define SII_RSL        0x1000    /* 0 = select, 1 = reselect desired device    */
  183.  
  184. /* Commands     I - Initiator, T - Target, D - Disconnected              */
  185. #define SII_INXFER    0x0800    /* Information Transfer command    (I,T)          */
  186. #define SII_SELECT    0x0400    /* Select command        (D)          */
  187. #define SII_REQDATA    0x0200    /* Request Data command        (T)          */
  188. #define    SII_DISCON    0x0100    /* Disconnect command        (I,T,D)          */
  189. #define SII_CHRESET    0x0080    /* Chip Reset command        (I,T,D)          */
  190. /* Chip state bits */
  191. #define    SII_CON        0x0040    /* Connected                      */
  192. #define SII_DST        0x0020    /* Destination                      */
  193. #define SII_TGT        0x0010    /* Target                      */
  194. #define SII_STATE_MSK  0x0070    /* State Mask                      */
  195. /* SCSI control lines */
  196. #define SII_ATN        0x0008    /* Assert the SCSI bus ATN signal          */
  197. #define    SII_MSG        0x0004    /* Assert the SCSI bus MSG signal          */
  198. #define    SII_CD        0x0002    /* Assert the SCSI bus C/D signal          */
  199. #define    SII_IO        0x0001    /* Assert the SCSI bus I/O signal          */
  200.  
  201. /*
  202.  * DICTRL - Diagnostic Control Register
  203.  */
  204. #define SII_PRE        0x4    /* Enable the SII to drive the SCSI bus          */
  205.  
  206. #define SII_WAIT_COUNT        10000   /* Delay count used for the SII chip  */
  207. #define SII_MAX_DMA_XFER_LENGTH    8192      /* Max DMA transfer length for SII    */
  208.  
  209. ClientData    DevSIIInit();
  210. Boolean        Dev_SIIIntr();
  211. ScsiDevice    *DevSIIAttachDevice();
  212.  
  213. #endif _SII
  214.